﻿
Namespace LightSwitchApplication

    Public Class PatientMedicationDetails

        Private myDialogHelper As ModalWindow

        Private Sub PatientMedicationDetails_InitializeDataWorkspace(saveChangesTo As System.Collections.Generic.List(Of Microsoft.LightSwitch.IDataService))
            ' Write your code here.
            If Not PatientNo = Nothing Then
                Me.PatientProperty = Me.Patient
                Me.DisplayName = "Medications - " & Me.Patient.SummaryName
            Else
                Me.PatientProperty = New Patient()
            End If
            
            myDialogHelper = New ModalWindow(Me.Medications, "AddEditMedication")
            Me.ScreenHeader = "Medication Details"
        End Sub

        Private Sub PatientMedicationDetails_Saved()
            ' Write your code here.
            'Me.Close(False)
            'Application.Current.ShowDefaultScreen(Me.PatientProperty)
            Me.Refresh()
        End Sub


        Private Sub PatientMedicationDetails_Created()
            ' Write your code here.
            myDialogHelper.Initialise()
        End Sub


        Private Sub MedicationsAddAndEditNew1_CanExecute(ByRef result As Boolean)
            ' Write your code here.
            result = myDialogHelper.CanAdd
        End Sub

        Private Sub MedicationsAddAndEditNew1_Execute()
            ' Write your code here.            
            myDialogHelper.AddEntity()
        End Sub

        Private Sub MedicationsEditSelected_CanExecute(ByRef result As Boolean)
            ' Write your code here.
            result = myDialogHelper.CanView
        End Sub

        Private Sub MedicationsEditSelected_Execute()
            ' Write your code here.
            myDialogHelper.ViewEntity()
        End Sub
        Private Sub EditDialogOk_Execute()

            myDialogHelper.DialogOk()

        End Sub

        Private Sub EditDialogCancel_Execute()

            myDialogHelper.DialogCancel()

        End Sub

        
      
        Private Sub MedicationsEditSelected1_CanExecute(ByRef result As Boolean)
            ' Write your code here.
            result = myDialogHelper.CanView
        End Sub

        Private Sub MedicationsEditSelected1_Execute()
            ' Write your code here.
            myDialogHelper.ViewEntity()
        End Sub

        Private Sub MedicationsDeleteSelected_CanExecute(ByRef result As Boolean)
            ' Write your code here.

        End Sub

        Private Sub MedicationsDeleteSelected_Execute()
            ' Write your code here.
            Medications.SelectedItem.Previous = True
        End Sub
    End Class


    


End Namespace